//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Malla.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)
Malla::Malla(){}
Malla::~Malla(){
        for(int i=0;i<nV;i++){
                delete vertice[i];
        }
        delete []vertice;
        for(int i=0;i<nN;i++){
                delete normal[i];
        }
        delete [] normal;
        for(int i=0;i<nC;i++){
                delete cara[i];
        }
        delete [] cara;
}
void Malla::dibuja(){
        for(int i=0;i<nC;i++){
                glLineWidth(1.0);
                //glBegin(GL_LINE_LOOP);
                glBegin(GL_POLYGON);
                //glNormal3f(normal[i]->getX(), normal[i]->getY(), normal[i]->getZ());
                for(int j=0; j<cara[i]->getVN();j++){
                        int iV=cara[i]->getIV(j);
                        int iN=cara[i]->getIN(j);

                        glNormal3f(normal[iN]->getX(), normal[iN]->getY(), normal[iN]->getZ());
                        glVertex3f(vertice[iV]->getX(), vertice[iV]->getY(), vertice[iV]->getZ());
                }
                glEnd();
        }
}
